package thread;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

public class SyncDemo3 {
    public static void main(String[] args) {
//        Thread t1 = new Thread(Boo::doSome);
//        Thread t2 = new Thread(Boo::doSome);
        Boo b1 = new Boo();
        Boo b2 = new Boo();
        Thread t1 = new Thread(()->b1.doSome());
        Thread t2 = new Thread(()->b2.doSome());


        t1.start();
        t2.start();
    }
}
class Boo {
    //    public synchronized static  void  doSome(){
    public static void doSome() {
        synchronized (Boo.class) {
            Thread t = Thread.currentThread();
            System.out.println(t.getName() + ":正在执行doSme方法...");
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
            }
            System.out.println(t.getName() + ":执行doSome方法完毕");
        }
    }
}